package org.gp953.system.service.impl;

import org.gp953.basic.service.impl.BaseServiceImpl;
import org.gp953.system.domain.DictionaryType;
import org.gp953.system.mapper.DictionaryDetailMapper;
import org.gp953.system.mapper.DictionaryTypeMapper;
import org.gp953.system.service.IDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DictionaryTypeServiceImpl extends BaseServiceImpl<DictionaryType> implements IDictionaryTypeService {
    @Autowired
    private DictionaryTypeMapper dictionaryTypeMapper;
    @Autowired
    private DictionaryDetailMapper dictionaryDetailMapper;

    @Override
    public void delete(Long id) {
        if (id!=null){
            dictionaryDetailMapper.deleteAllByTypesId(id);
        }
        super.delete(id);
    }

    @Override
    public void patchDelete(List<Long> ids) {
        if (ids!=null){
            dictionaryDetailMapper.deleteAllByTypesListId(ids);
        }
        super.patchDelete(ids);
    }
}
